package com.zretc.auth.controller;

import com.zretc.api.pojo.SysUser;
import com.zretc.auth.dao.SysUserMapper;
import com.zretc.auth.service.SysUserService;
import com.zretc.common.entity.R;
import com.zretc.common.entity.RespResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("/auth")
public class SysUserController {
    @Autowired
    private SysUserService sysUserService;
    @GetMapping("/queryUserInfo")
    public RespResult queryUserInfoById(Integer id)
    {
        SysUser user=sysUserService.querySysUserInfo(id);
        if(user==null) return R.fail(200,"数据库没有此人");
        else return R.success(user);
    }
    @PostMapping("/updateUserInfo")
    public RespResult updateUserInfoById(@RequestBody SysUser user)
    {
        if(!sysUserService.updateSysUserInfo(user))return R.fail(411,"修改失败");
        return R.success(null);
    }
}
